package cn.itcast.com.String;

public class StringrBuffer {
    public static void main(String[] args) {
        String s = "Hello ";
        String a = "world";
        //创建一个空字符
        StringBuffer ss = new StringBuffer();
        System.out.println(s);
        //往后添加字符串
        System.out.println(ss.append("Hello"));
        //往指定位置添加字符串
        System.out.println(ss.insert(2,"sad"));
        //删除指定位置的字符
        System.out.println(ss.deleteCharAt(5));
        //删除指定范围的字符，瞻前不顾后
        System.out.println(ss.delete(1,3));
        //删除指定范围的字符，瞻前不顾后，并替换为指定字符串
        System.out.println(ss.replace(3,4,"ss"));
        //逆置字符串
        System.out.println(ss.reverse());
        //获得截取从指定位置到之后的字符串
        System.out.println(ss.substring(4));
        //获得截取指定范围的字符，瞻前不顾后
        System.out.println(ss.substring(1,3));
        char[] r = {'a','b','c'};
        System.out.println(String.valueOf(r));

    }
}
